home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
2614.ZIP
/
TSL.ZIP
/
TSL.ASM
next >
Wrap
Assembly Source File
|
1989-08-29
|
2KB
|
96 lines
; TSL.ASM
INCLUDE EXTENDA.INC
CLpublic <TSL>
CODESEG
CLfunc char TSL <char String,char Source,char Dest,int TableLen,int FieldLen>
CLcode
PUSH ES
CMP PCOUNT,5
JB TSL_RET
TESTNUL String
JZ TSL_RET
LES SI,String
MOV BX,0
TSL_LOOP:
CMP BX,FieldLen
JE TSL_RET
MOV AL,BYTE PTR ES:[BX+SI]
CMP AL,20H
JZ LOOP_INS
CMP AL,127
JA CHANGE_IT
JB REPLACE
CHANGE_IT:
CALL LOOKUP
REPLACE:
MOV BYTE PTR ES:[BX+SI],AL
LOOP_INS:
INC BX
JMP TSL_LOOP
TSL_RET:
POP ES
CLret String
WORKFUNCS
LOOKUP PROC NEAR
PUSH SI
PUSH DI
PUSH ES
PUSH DS
POP ES
PUSH BX
PUSH AX
MOV AX,DS
MOV ES,AX
POP AX
LES DI, Source
MOV BX,DI
MOV CX,TableLen
CLD
REPNE SCASB
JZ GOT_HIT
JMP LOOKUP_EXIT
GOT_HIT:
PUSH SI
DEC DI
SUB DI,BX
MOV BX,DI
LES SI,Dest
MOV AL,ES:[SI+BX]
POP SI
LOOKUP_EXIT:
POP BX
POP ES
POP DI
POP SI
RET
LOOKUP ENDP
ENDWORK
END